package com.seguriapp.util;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.seguriapp.base.BaseEntity;

/**
 * Represents a criminal item for the map.
 * 
 * @author Tania Gonzales(taniadgv@gmail.com)
 */

public class CriminalItem extends BaseEntity {

  private static final long serialVersionUID = -3027178240812354909L;

  private double longitude;

  private double latitude;

  private double radio;

  private List<CrimeDescription> crimeDescriptionList;

  public double getLongitude() {
    return longitude;
  }

  public double getLatitude() {
    return latitude;
  }

  public double getRadio() {
    return radio;
  }

  public List<CrimeDescription> getCrimeDescriptionList() {
    return crimeDescriptionList;
  }

  public void setLongitude(final double longitude) {
    this.longitude = longitude;
  }

  public void setLatitude(final double latitude) {
    this.latitude = latitude;
  }

  public void setRadio(final double radio) {
    this.radio = radio;
  }

  public void setCrimeDescriptionList(final List<CrimeDescription> crimeDescriptionList) {
    this.crimeDescriptionList = crimeDescriptionList;
  }

  public Map<String, Object> toJsonString() {
    Map<String, Object> map = new LinkedHashMap<String, Object>();
    map.put("latitude", latitude);
    map.put("longitude", longitude);
    map.put("radio", radio);
    if (crimeDescriptionList != null) {
      final List<Map<?, ?>> l1 = new LinkedList<Map<?, ?>>();
      for (final CrimeDescription crimeDescription : crimeDescriptionList) {
        l1.add(crimeDescription.toJsonString());
      }
      map.put("crimeDescriptionList", l1);
    }
    return map;
  }

}
